<%@ page pageEncoding="UTF-8"%>

<%@ taglib uri="/tags/struts-tiles" prefix="tiles"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/struts-nested" prefix="nested"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>


<div style="margin: 0 15px;">

	<!-- My Order -->
	<div class="box" style="margin-top:5px;">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<col width="6px" />
			<col width="946px" />
			<col width="6px" />
			<tr>
				<td class="box_top_l"></td>
				<td class="box_top_c box_title">我的订单</td>
				<td class="box_top_r"></td>
			</tr>
			<tr>
				<td class="box_left"></td>
				<td>
					<div class="box_content">
						<table class="datagrid no_hover" cellspacing="0" cellpadding="0" width="100%" border="1">
							<thead>
								<tr>
									<td>订单编号</td>
									<td>订票人</td>
									<td>订单金额(元)</td>
									<td>订单时间</td>
									<td>订单状态</td>
									<td>订单编辑</td>
									<td>操作</td>
								</tr>
							</thead>
							<tbody>
							    <c:forEach items="${orderList}" var="item" varStatus="vs">
								<tr>
									<td align="center">${item.orderNo}</td>
									<td align="center">${item.orderOwner.accountRealName}</td>
									<td align="center">${item.orderCost}</td>
									<td align="center">${item.orderCreateTime}</td>
									<td align="center">
									<c:if test="${item.orderStatus == null }">
									未提交
									</c:if>
									<c:if test="${item.orderStatus == '1' }">
									已提交
									</c:if>
									<c:if test="${item.orderStatus == '2' }">
									订单处理中
									</c:if>
									<c:if test="${item.orderStatus == '3' }">
									订票成功
									</c:if>
									<c:if test="${item.orderStatus == '4' }">
									订票失败
									</c:if>
									
									
									</td>
									
									<input type="hidden" name="type" value=""/>
									<td align="center">
									<c:if test="${item.orderStatus == null }">
									<a  style="color:blue;align:left;" href="app/order/edit?id=${item.id}" >编辑</a> 
									<a  style="color:blue;" href="app/order/delete?id=${item.id}">删除</a>
									</c:if>
									
									
									</td>
									
									<td align="center">
									<c:if test="${item.orderStatus == null }">
									<a  style="color:blue;" href="app/order/submit?id=${item.id}">提交</a>
									</c:if>
									<c:if test="${item.orderStatus == '1' }">
									订单处理中
									</c:if>
									<c:if test="${item.orderStatus == '2' }">
									订单处理中
									</c:if>
									<c:if test="${item.orderStatus == '3' }">
									订单处理完成
									</c:if>
									<c:if test="${item.orderStatus == '4' }">
									<a  style="color:blue;" href="app/order/delete?id=${item.id}">删除</a>
									</c:if>
									</td>
								</tr>
								</c:forEach>
							</tbody>
						</table>	
					</div>
				</td>
				<td class="box_right"></td>
			</tr>
			<tr>
				<td class="box_btm_l"></td>
				<td class="box_btm_c"></td>
				<td class="box_btm_r"></td>
			</tr>
		</table>
	</div>
	
	<!-- Order Information -->
	<div class="box" style="margin-top:5px;">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<col width="6px" />
			<col width="946px" />
			<col width="6px" />
			<tr>
				<td class="box_top_l"></td>
				<td class="box_top_c box_title">订单详情</td>
				<td class="box_top_r"></td>
			</tr>
			<tr>
				<td class="box_left"></td>
				<td>
					<div class="box_content">
						<table class="datagrid no_hover" cellspacing="0" cellpadding="0" width="100%" border="1">
							<thead>
								<tr>
									<td style="background:none;border-bottom: 1px solid #FFFFFF;border-left: 1px solid #FFFFFF;border-top: 1px solid #FFFFFF;"></td>
									<td>车次</td>
									<td>始发站</td>
									<td>发车时间</td>
									<td>到达站</td>
									<td>到达时间</td>
									<td>发车时间</td>
									<td>车票类型</td>
									<td>订票数</td>
									<td>车票金额</td>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${orderList}" var="order" varStatus="vs">
				                    <tr>
									    <td style="border-bottom: 1px solid #FFFFFF;border-left: 1px solid #FFFFFF;border-top: 1px solid #FFFFFF;" align="center">首选</td>
		                                <td align="center" width="150">
		                                 ${order.orderTrain.trainNumber} (${order.orderTrain.trainStationStarting} - ${order.orderTrain.trainStationTerminating})
		                                </td>
		                               
		                                <td align="center">
		                                      <c:out value="${order.orderTrainStationFrom}"/>
		                                </td>
		                                <td align="center">
		                               
		                                <c:out value="${order.orderTrain.trainScheduleStartingVO.trainDepartureTime}"/>
		                               
		                                </td>
		                                 <td align="center">
		                                      <c:out value="${order.orderTrainStationTo}"/>
		                                </td>
		                                 <td align="center">
		                                  <c:out value="${order.orderTrain.trainScheduleTerminationVO.trainArriveTime}"/>
		                                </td>
		                                 <td align="center">
		                                      <c:out value="${fn:substring(order.orderTrainDate1st,0,10)}"/>
		                                       
		                                </td>
		                                 <td align="center">
		                                   <c:choose>
										    <c:when test="${order.orderTrainSeatType1st=='1'}">
										     硬座		
											</c:when>
											<c:when test="${order.orderTrainSeatType1st=='2'}">
										     硬卧		
											</c:when>
											<c:when test="${order.orderTrainSeatType1st=='3'}">
										     软座	
											</c:when>
											<c:when test="${order.orderTrainSeatType1st=='4'}">
										     软卧		
											</c:when>
											<c:when test="${order.orderTrainSeatType1st=='5'}">
										     一等座		
											</c:when>
											<c:when test="${order.orderTrainSeatType1st=='6'}">
										     二等座	
											</c:when>
											
											</c:choose>
		                                 
		                                    
		                                </td>
		                                 <td align="center">
		                                      <c:out value="${order.orderNumber}"/>
		                                </td>
		                                 <td align="center">
		                                      <c:out value="${order.orderCost*order.orderNumber}"/>
		                                </td>
			                            </tr>                    
				                </c:forEach>
							</tbody>
						</table>	
					</div>
				</td>
				<td class="box_right"></td>
			</tr>
			<tr>
				<td class="box_btm_l"></td>
				<td class="box_btm_c"></td>
				<td class="box_btm_r"></td>
			</tr>
		</table>
	</div>
	
	<!-- Owner Profile -->
	<div class="box" style="margin-top:5px;">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<col width="6px" />
			<col width="946px" />
			<col width="6px" />
			<tr>
				<td class="box_top_l"></td>
				<td class="box_top_c box_title">订票人信息</td>
				<td class="box_top_r"></td>
			</tr>
			<tr>
				<td class="box_left"></td>
				<td>
					<div class="box_content">
						<table class="datagrid no_hover" cellspacing="0" cellpadding="0" width="100%" border="1">
							<thead>
								<tr>
									<td>学号</td>
									<td>姓名</td>
									<td>专业</td>
									<td>班级</td>
									<td>校园卡号</td>
									<td>邮箱</td>
									<td>手机号码</td>
									<td>住址</td>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td align="center">${sessionScope.USER.accountNo}</td>
									<td align="center">${sessionScope.USER.accountRealName}</td>
									<td align="center">${sessionScope.USER.accountMajority}</td>
									<td align="center">${sessionScope.USER.accountClass}</td>
									<td align="center"></td>
									<td align="center">${sessionScope.USER.accountEmail}</td>
									<td align="center">${sessionScope.USER.accountMobilePhone}</td>
									<td align="center"></td>
								</tr>
							</tbody>
						</table>	
					</div>
				</td>
				<td class="box_right"></td>
			</tr>
			<tr>
				<td class="box_btm_l"></td>
				<td class="box_btm_c"></td>
				<td class="box_btm_r"></td>
			</tr>
		</table>
	</div>

</div>